from django.db import models
from jrcmodel.models import MyConstants
from django.contrib.auth.models import User

class Xyz(models.Model):
    name = models.CharField(max_length = 4)

    def get_cc_root_only(self, obj):
        #print request.user
        return "CC"

class Signals(models.Model):
    cst = models.CharField(max_length = 128)
    asset = models.CharField(max_length = 128)
    dir_name = models.CharField(max_length = 128)
    price = models.DecimalField(max_digits = 10, decimal_places = 2)

class Uid(models.Model):
    uid = models.CharField(max_length = 64)
    status_id = models.IntegerField(default = MyConstants.STATUS_APPROVED)
    valid_till = models.DateTimeField()
    
    @staticmethod
    def get_and_validate(uid):
        item = Uid.objects.get(uid = uid)
        print "Got item by UID: %d" % item.pk

    

#class JrcApp(models.Model):
#    name = models.CharField(max_length = 64)
#    url = models.CharField(max_length = 64)
#    
#class JrcAppUserPermission(models.Model):
#    user_id = models.ManyToManyField(User)
#    jrc_app_id = models.ManyToManyField(JrcApp)
#    role_name = models.CharField(max_length = 32, default = "edit", choices = JRC_PERMISSION_CHOICES)
#    is_allowed = models.BooleanField(default = True)

#class Port(models.Model):
#    name = models.CharField(max_length=128)
#
#    def __unicode__(self):
#        return "%s" % self.name
#
#class Cstt(models.Model):
#    name = models.CharField(max_length=128)
#    portfolios = models.ManyToManyField(Port)
#
#class Poll(models.Model):
#    question = models.CharField(max_length=128)
#
#class Choice(models.Model):
#    poll = models.ForeignKey(Poll)
#    name = models.CharField(max_length=128)
#
#class Girl(models.Model):
#    name = models.CharField(max_length = 128)

#class ArchivePerf(models.Model):
#    year = models.IntegerField()
#    month = models.IntegerField()
#    value = models.DecimalField(max_digits = 18, decimal_places = 14)
#    
#    def __unicode__(self):
#        return "%d-%d: %.14g" % (self.year, self.month, self.value)
#
#class DvRatio(models.Model):
#    year = models.IntegerField()
#    month = models.IntegerField()
#    value = models.DecimalField(max_digits = 10, decimal_places = 4)
#    
#    def __unicode__(self):
#        return "%d-%d: %.14g" % (self.year, self.month, self.value)
